home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pgp20src.zip / ZIP.C < prev    next >
C/C++ Source or Header  |  1992-07-10  |  1KB  |  45 lines

  1. /* Support code for the zip/unzip code - just handles error messages.  To
  2.    get exact errors, define ZIPDEBUG */
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include "usuals.h"
  7. #include "fileio.h"
  8. #include "language.h"
  9. #include "pgp.h"
  10.  
  11. /* The following are defined in zip.h but it's easier to redefine them here
  12.    since the header files do wierd things with __STDC__-compatibility */
  13.  
  14. #define ZE_MEM        4
  15.  
  16. /* Clean error exit: c is a ZE_-class error, *msg is an error message.
  17.    Issue a message for the error, clean up files and memory, and exit */
  18.  
  19. void err(int c, char *msg)
  20.     {
  21.  
  22. #ifdef ZIPDEBUG
  23.     if (PERR(c))
  24.         perror("zip error");
  25.     fprintf(stderr, "zip error: %s (%s)\n", errors[c-1], msg);
  26. #endif /* ZIPDEBUG */
  27.  
  28.     /* Complain and return and out of memory error code */
  29.     if(c==ZE_MEM)
  30.     {    fprintf( stderr, PSTR("\nOut of memory\n") );
  31.         exitPGP( 7 );
  32.     }
  33.     else
  34.     {    fprintf( stderr, PSTR("\nCompression/decompression error\n") );    /* Yuck */
  35.         exitPGP( 23 );
  36.     }
  37.     }
  38.  
  39. /* Internal error, should never happen */
  40.  
  41. void error(char *msg)
  42.     {
  43.     err(-1, msg);
  44.     }
  45.